<?php 
	$auth = Zend_Auth::getInstance();
	$identity = $auth->getIdentity();
        function loadsubmenu($mainmenuid){
            Zend_loader::loadClass('Admin_Models_MenuModel');
            $db = new Admin_Models_MenuModel();
            $result = $db->loadsubmenu($mainmenuid);
            return $result;
            
        }

?>

<!-- End Live Search -->
         
<ul id="sidebar-nav">
            
            <?php foreach($this->mainmenu as $mainmenuitem){ ?>
            <li><a href="#" class=''><?php echo $mainmenuitem['name'];?></a>
         
            <ul class="drop" style="<?php if(strpos($this->arrParam['controller'], $mainmenuitem['controller'])!== false  ) echo 'display: block' ?>">
                <?php $submenu = loadsubmenu($mainmenuitem['id']); ?>
                <?php foreach($submenu as $submenuitem){ ?>
                <li><a href="<?php echo $submenuitem['link'];?>"><img src="<?php echo $this->imgUrl."/"?>more_arrow.png"/><?php echo $submenuitem['name'];?></a></li>
                <?php }?>
            </ul>
            </li>    
            <?php } ?>
            
 
</ul>
<!-- End SideBar -->
<br class="cl" /> 
<script type="text/javascript">
//Menu sidebar
$('#sidebar-nav > li > a').click(function(){
	    if ($(this).attr('class') != 'active'){
	      $('#sidebar-nav li ul').slideUp();
	      $(this).next().slideToggle();
	      $('#sidebar-nav li a').removeClass('active');
	      $(this).addClass('active');
	    }else{
	       $('#sidebar-nav li ul').slideUp();
           $('#sidebar-nav li a').removeClass('active');
	    }
         return false;
	  });
</script>
